package com.company.project.bean;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

import java.util.ArrayList;
import java.util.List;

/**
 * IntelliJ IDEA.
 * User: lwb
 * Date: 2017/11/30
 * Time: 17:45
 * function:
 */
public class RankUser {

    private Float score;
    private String nickName;
    private String imageUrl;
    private Integer rank;
    private List<RankUser> subUser = new ArrayList<>();;

    public static void main(String[] args) {

        List<RankUser> list = new ArrayList<>();

        RankUser a = new RankUser();
        a.setScore((float) 2);
        a.setNickName("aaa");
        a.setImageUrl("aa/a.jpg");
        a.setRank(2);

        RankUser r = new RankUser();
        r.setScore((float) 2);
        r.setNickName("aaa");
        r.setImageUrl("aa/a.jpg");
        r.setRank(2);

        RankUser f = new RankUser();
        f.setScore((float) 3);
        f.setNickName("bb");
        f.setImageUrl("abba/ba.jpg");
        f.setRank(2);

        r.getSubUser().add(r);
        r.getSubUser().add(f);

        list.add(a);
        list.add(r);
        
        System.out.println(list);
        System.out.println(JSON.toJSONString(list , SerializerFeature.DisableCircularReferenceDetect) );



    }

    public List<RankUser> getSubUser() {
        return subUser;
    }

    public void setSubUser(List<RankUser> subUser) {
        this.subUser = subUser;
    }

    public Float getScore() {
        return score;
    }

    public void setScore(Float score) {
        this.score = score;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public Integer getRank() {
        return rank;
    }

    public void setRank(Integer rank) {
        this.rank = rank;
    }
}
